<?php
class Action_Generic_DirectToTemplate extends RL_Handler
{

	public function process ()
	{
		$this->ctx->debug->trace('[Action_Generic_DirectToTemplate] start');
		$template = $this->params['template'];

		$this->ctx->debug->trace('[Action_Generic_DirectToTemplate] request view "'.$template.'"');
		$this->ctx->rh->useClass('RL_View');
		// есть шаблон с таким именем?
		if ($this->ctx->tpl->findTemplate(preg_replace('#\\.html?$#', '', $template))) {
			$view = RL_View::create($this->ctx, 'Template');
			$view->setTemplate($template);
		} else
		// а может $template это имя вьюхи?
			if ($view = $this->rh->views->findByName($template)) {
		}
		if ($view) {
			$this->rh->response->setContent($view);
		} else {
			$this->ctx->debug->error('[Action_Generic_DirectToTemplate] view "'.$template.'"not found');
		}
	} // end of function process

}

?>
